<template>
  <div>
			app.vue
			
			<router-link to="/home">home</router-link>
			<router-link to="/discover">discover</router-link>
			<router-link to="/contact">cantact</router-link>
			
			<br><br>
			<div>
				<input type="text" name="" id="" v-model="inputValue" value="" />  	
				<button @click="SubmitClick">提交</button>
			</div>
  
		  <ul>
		  	<todo-item
		  		v-for="(item,index) of list"
		  		:content="item"
		  		:key="index"
		  		:index="index"
		  		@delete="handleDelete"
		  		>
		  		
		  	</todo-item>
		  </ul>
		  
		  <router-view></router-view>
		  
  </div>
  
</template>

<script>
import HelloWorld from './components/hello'
export default {
// 	data:function(){
// 		return {
// 			inputValue:""
// 		}
// 	}  
//es6里语法简化可为
 	components:{
			'todo-item':HelloWorld
 	},
	data(){
		return{
			inputValue:"",
			list:[]
		}
	},
	methods:{
//		SubmitClick:function(){}
			SubmitClick(){	
					this.list.push(this.inputValue);
					this.inputValue="";
			},
			handleDelete(index){
				this.list.splice(index,1);
			}
	}




}
</script>

<style>

</style>
